package com.yiqi.liebang.feature.order.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.yiqi.liebang.entity.bo.OrderBo;
import com.yiqi.liebang.entity.bo.PageBo;
import com.yiqi.liebang.entity.bo.TopicBo;
import com.yiqi.liebang.entity.bo.TopicListBo;
import com.yiqi.liebang.feature.home.contract.TopicContract;
import com.yiqi.liebang.feature.home.dependencies.topic.DaggerTopicModelComponent;
import com.yiqi.liebang.feature.order.contract.OrderContract;
import com.yiqi.liebang.feature.order.dependencies.order.DaggerOrderModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.HomeApi;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

public class OrderModel implements OrderContract.Model {

    @Inject
    HomeApi api;


    @Inject
    public OrderModel() {
        DaggerOrderModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<List<OrderBo>> getOrderList(PageBo pageBo) {
        return api.getOrderList(pageBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
